package com.chinasofti.udp;

import java.io.IOException;
import java.net.*;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        //创建发送端是socket
        DatagramSocket ds = new DatagramSocket();
        String s = "hi 组播";
        byte [] bytes=s.getBytes();
        InetAddress address = InetAddress.getByName("224.0.1.0");
        int port =10000;
        //创建数据包
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length,address,port);

        ds.send(dp);
        ds.close();
    }
}
